<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>图书管理系统</title>
    <link rel="stylesheet" type="text/css" th:href="@{/css/style.css}"/>
    <script type="text/javascript" th:src="@{/js/lib/jquery-1.11.0.min.js}"></script>
    <link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body>
<div id="wrap">
    <div th:replace="inc/before/head :: div"></div>

    <div class="center_content">
        <div class="left_content">
            <div class="title"><span class="title_icon"><img src="images/bullet1.gif" alt="" title=""/></span>注册</div>

            <div class="feat_prod_box_details">

                <div class="contact_form">
                    <div class="form_subtitle">注册用户</div>
                    <form id="registerForm" name="register" th:action="@{/admin/user/saveUser}" method="post">
                        <div class="form_row">
                            <label class="contact"><strong>用户名:</strong></label>
                            <input type="text" class="contact_input" name="username" id="username"/>
                        </div>

                        <div class="form_row">
                            <label class="contact"><strong>姓名:</strong></label>
                            <input type="text" class="contact_input" name="name" id="name"/>
                        </div>

                        <div class="form_row">
                            <label class="contact"><strong>密码:</strong></label>
                            <input type="password" class="contact_input" name="password" id="password"/>
                        </div>

                        <div class="form_row">
                            <label class="contact"><strong>Email:</strong></label>
                            <input type="text" class="contact_input" name="email"/>
                        </div>


                        <div class="form_row">
                            <label class="contact"><strong>电话:</strong></label>
                            <input type="text" class="contact_input" name="phone"/>
                        </div>

                        <div class="form_row">
                            <input type="button" id="registerBtn" class="register" value="注册"/>
                        </div>
                    </form>
                </div>

            </div>

            <div class="clear"></div>
        </div><!--end of left content-->

        <div th:replace="inc/before/right :: div"></div>
        <div class="clear"></div>
    </div><!--end of center content-->
    <div th:replace="inc/before/footer :: div"></div>


</div>

</body>
<script type="text/javascript">
    $(function () {
        $('#menu a').each(function () {
            var aText = $(this).text();
            if ('注册' == aText) {
                $(this).parent('li').addClass('selected');
            } else {
                $(this).parent('li').removeClass('selected');
            }

        });

        $('#registerBtn').on('click',function(){
            var username = $('#username').val();
            if(username == '' || username == null){
                alert('用户名不能为空');
                $('#username').focus();
                return;
            }
            var name = $('#name').val();
            if(name == '' || name == null){
                alert('姓名不能为空');
                $('#name').focus();
                return;
            }
            var password = $('#password').val();
            if(password == '' || password == null){
                alert('密码不能为空');
                $('#password').focus();
                return;
            }

            $('#registerForm').submit();
        });


    });
</script>
</html>